
set more off
cd "D:\Projects\HeterogeneousExternalities\"

import excel "Output\SimulationResults_Tax_0.2.xlsx", clear

ren A tax_change
ren B fulltax
ren C vmt_opt
ren D opt_rev
ren E s_rev
ren F statetax
gen id=_n
merge 1:1 id using  "Data\AncillarySimulation.dta", nogen keep(3)

ren tax_change tax_change20
ren fulltax fulltax20
keep county_fips urban tax_change fulltax	
save "Data\Results20.dta",replace


import excel "Output\SimulationResults_Tax_1.5.xlsx", clear

ren A tax_change
ren B fulltax
ren C vmt_opt
ren D opt_rev
ren E s_rev
ren F statetax
gen id=_n
merge 1:1 id using  "Data\AncillarySimulation.dta", nogen keep(3)

ren tax_change tax_change150
ren fulltax fulltax150
keep county_fips urban tax_change fulltax	
save "Data\Results150.dta",replace


merge 1:1 county_fips using "Data\Results20.dta", keep(3) nogen





	
	twoway hist tax_change150 if urban==1, width(.2) frac lcolor(gs4) fcolor(gs12) discrete || /*
	*/ hist tax_change20 if urban==1, frac fcolor(blue%60) lcolor(gs4) width(.15) name(hist_urb1, replace)  title(Large Central Metro)/*
	*/ xlabel(-.5(.2)1.5, nogrid) ylabel(,nogrid) legend(label(1 "$1.50/gallon Maximum Tax") /*
	*/ label(2 "$0.20/gallon Maximum Tax") col(2) order(2 1))  discrete

	
	
	
	
	twoway hist tax_change150 if urban==2, width(.2) frac lcolor(gs4) fcolor(gs12) 	discrete || /*
	*/ hist tax_change20 if urban==2, frac fcolor(blue%60) lcolor(gs4) width(.15) name(hist_urb2, replace) title(Large Fringe Metro) /*
	*/ xlabel(-.5(.2)1.5, nogrid) ylabel(,nogrid) 	discrete

	
	
	
	
	
	twoway hist tax_change150 if urban==3, width(.2) frac lcolor(gs4) fcolor(gs12) 	discrete  || /*
	*/ hist tax_change20 if urban==3, frac fcolor(blue%60) lcolor(gs4) width(.15) name(hist_urb3, replace) title(Medium Metro) /*
	*/ xlabel(-.5(.2)1.5, nogrid) ylabel(,nogrid) nodraw 	discrete

	 
	
	
	twoway hist tax_change150 if urban==4, width(.2) frac lcolor(gs4) fcolor(gs12)  	discrete || /*
	*/ hist tax_change20 if urban==4, frac fcolor(blue%60) lcolor(gs4) width(.15) name(hist_urb4, replace)  title(Small Metro) /*
	*/ xlabel(-.5(.2)1.5, nogrid) ylabel(,nogrid) nodraw 	discrete

	
	
	grc1leg  hist_urb1 hist_urb2 hist_urb3 hist_urb4 ,  altshrink graphregion(color(white) margin(l=0 r=0)) col(2) iscale(1.75) legendfrom(hist_urb1)
